<extend name="Public/base"/>
<block name="body">
    <div class="page-crumb">
        <div class="ui-ctrl ui-crumb"><span class="ui-crumb-node ui-crumb-node-first ui-crumb-node-last">广告投放管理</span></div>
    </div>

    <div class="layui-main">
        <div class="list-meta">
            <div class="list-action">
                <a class="ui-link skin-add-link" href="javascript:;" onclick="PopModel.openFrame('/AdDelivery/add');" target="">新建广告投放</a>
            </div>
            <div class="list-filter">
            </div>

        </div>

        <!-- 数据列表 -->
        <table class="layui-table list-content-table" lay-skin="nob">
            <colgroup>
				<col width="20">
                <col width="200">
                <col width="100">
                <col width="200">
                <col width="200">
                <col width="100">
                <col width="250">
                <col width="100">
                <col width="100">
                <col width="200">
            </colgroup>
            <thead class="list-table-head">
            <tr>
				<th class="ui-table-hcell">
					<div class="ui-table-hcell-text ui-table-hcell-text-first">
						<input type="checkbox" class="ui-table-select-all" data-index="">
					</div>
				</th>
                <th class="ui-table-hcell">
                    <div class="ui-table-hcell-text">广告投放名称</div>
                </th>
                <th class="ui-table-hcell">
                    <div class="ui-table-hcell-text">状态</div>
                </th>
                <th class="ui-table-hcell">
                    <div class="ui-table-hcell-text">代码位</div>
                </th>
                <th class="ui-table-hcell">
                    <div class="ui-table-hcell-text">物料</div>
                </th>
                <th class="ui-table-hcell">
                    <div class="ui-table-hcell-text">计费</div>
                </th>


                <th class="ui-table-hcell">
                    <div class="ui-table-hcell-text">投放时间</div>
                </th>
                <th class="ui-table-hcell">
                    <div class="ui-table-hcell-text">进度</div>
                </th>

                <th class="ui-table-hcell">
                    <div class="ui-table-hcell-text">创建时间</div>
                </th>

                <th class="ui-table-hcell">
                    <div class="ui-table-hcell-text">操作</div>
                </th>
            </tr>
            </thead>

            <tbody class="list-table-body">
            <foreach name="lists" item="delivery">
                <tr>
					<td class="ui-table-cell">
						<div class="ui-table-cell-text">
							<input type="checkbox" class="ui-table-multi-select" data-id="{$delivery.id}">
						</div>
					</td>
                    <td class="ui-table-cell"><div class="ui-table-cell-text">{$delivery.d_ad_name}<span class="table-content-addition">ID: {$delivery.id}</span></div></td>
                    <!--<td class="ui-table-cell"><div class="ui-table-cell-text">{$delivery.delivery_state}</div></td>-->
                    <td class="ui-table-cell">
                        <div class="ui-table-cell-text">
                            <if condition="$delivery.delivery_state eq 0">
                                <span class="table-status-inactive">待确认</span>
                            <elseif condition="$delivery.delivery_state eq 1"/>
                                <span class="table-status-inactive">草稿</span>
                            <elseif condition="$delivery.delivery_state eq 2"/>
                                <span class="table-status-inactive">删除</span>
                            <elseif condition="$delivery.delivery_state eq 3"/>
                                <span class="table-status-inactive">待投放</span>
                            <elseif condition="$delivery.delivery_state eq 4"/>
                                <span class="table-status-activated">投放中</span>
                            <elseif condition="$delivery.delivery_state eq 5"/>
                                <span class="table-status-inactive">投放完成</span>
                            </if>
                        </div>
                    </td>

                    <td class="ui-table-cell"><div class="ui-table-cell-text">{$delivery.code_name}</div></td>
                    <td class="ui-table-cell"><div class="ui-table-cell-text">{$delivery.ad_name}</div></td>

                    <!--<td class="ui-table-cell"><div class="ui-table-cell-text">{$delivery.billing_mode}</div></td>-->
                    <td class="ui-table-cell">
                        <div class="ui-table-cell-text">
                            <if condition="$delivery.billing_mode eq 1">
                                <span class="table-status-activated">CPD</span>
                                <elseif condition="$delivery.billing_mode eq 2"/>
                                <span class="table-status-activated">CPM</span>
                                <elseif condition="$delivery.billing_mode eq 3"/>
                                <span class="table-status-activated">CPC</span>
                            </if>
                        </div>
                    </td>

                    <td class="ui-table-cell"><div class="ui-table-cell-text">
                        <if condition="$delivery.delivery_time_set eq 1">
                            {$delivery.start_time|date="Y/m/d H:i", ###} ~
                            <if condition="$delivery.end_time_set eq 1">
                                {$delivery.end_time|date="Y/m/d H:i", ###}
                            <else />
                                不限结束时间
                            </if>

                            <else />
                                <?php foreach($delivery['interval_time'] as $k => $v) {
                                    echo "<p>$v</p>";
                                }?>
                        </if>
                    </div></td>

                    <td class="ui-table-cell">
                        <div class="layui-progress" lay-showPercent="yes">
                            <div class="layui-progress-bar layui-bg-blue" lay-percent="{$delivery.schedule}"></div>
                        </div>
                    </td>

                    <td class="ui-table-cell"><div class="ui-table-cell-text">{$delivery.ctime|date="Y-m-d",###}</div></td>
                    <td class="ui-table-cell">
                        <div class="ui-table-cell-text">
                            <span class="table-operation" data-command="state" 	data-command-args="{$delivery.id}">状态</span>
                            <span class="table-operation" data-command="modify" data-command-args="{$delivery.id}">编辑</span>
                            <span class="table-operation" data-command="remove" data-command-args="{$delivery.id}">删除</span>
                        </div>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        {$page}
    </div>
	<script src="__BACKEND_STATIC__/js/AdDelivery/delivery.js"></script>
</block>


